#include "process.h"
#include<stdio.h>
#include<unistd.h>

typedef void (*callback_t) (double total, double current);

double total = 1024.0;
double speed = 1.0;

void DownLoad(callback_t cb)
{
  double current = 0;
  while(current <= total)
  {
    cb(total, current);
    //下载代码
    usleep(1000);//休眠充当下载数据
    current += speed;
  }

  printf("\ndownload %.2lfMB Done\n",current-1.0);
}

int main()
{
  DownLoad(FlushProcess);
  return 0;
}
//void DownLoad()
//{
//  double current = 0;
//  while(current <= total)
//  {
//    FlushProcess(total, current);
//    //下载代码
//    usleep(1000);//休眠充当下载数据
//    current += speed;
//  }
//
//  printf("\ndownload %.2lfMB Done\n",current-1.0);
//}

//int main()
//{
//  DownLoad();
//  return 0;
//}
